-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Backend] Record when Consent is Served #3777
Conversation
…are many fields with PrivacyPreferenceHistory and CurrentPrivacyPreference. These tables track every time a notice was served in the frontend for a given user, and then the last time a notice was served for a user. - Update GET /privacy-experience to declare on the notice if it was served to an end user or if an older version has been served
…I when notices are served. Multiple notices that were served together should be sent in the same request.
…y center. This endpoint has logic capable of handling multiple identity types, such as an email and a fides user device id.
…n saving privacy preferences.
Passing run #3160 ↗︎
Details:
This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #3777 +/- ##
==========================================
+ Coverage 87.16% 87.27% +0.10%
==========================================
Files 311 311
Lines 19060 19222 +162
Branches 2462 2470 +8
==========================================
+ Hits 16614 16776 +162
Misses 2018 2018
Partials 428 428
☔ View full report in Codecov by Sentry. |
@allisonking when you have time, could you add the bit on the frontend that calls the new endpoints to record that consent was served? there are two endpoints, one for the privacy center, and one for banners/overlay. The response for these will return a "served_notice_history_id" for each notice that was served. Then you can take that id and pass it into the backend when saving preferences if applicable, to link those two records together. We can reticket too if you prefer, and I will hold off on merging this until we've tested this end to end - |
Thanks @pattisdr ! I think we should make a separate ticket for the frontend since the change is nontrivial. I talked to @rsilvery who is going to confirm if it's okay for the frontend ticket to go in the next sprint (ticket here: #3780) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great! I'll test it out further once I'm actually integrating with it :)
# Conflicts: # CHANGELOG.md
Thank you Allison! I responded to your comments - I'll go ahead and merge this I actually moved a lot of stuff around that I want to build off with TCF so I think we can just get this in there, and start writing to it later. |
Closes #3006
Description Of Changes
For consent reporting, and for other purposes like building gpp strings, we need records of whether consent was served, even if the user chose to not save any preferences.
We don’t necessarily record each time an API request is made to get consent, but instead whenever the components actually show something to the user. Therefore, add a new endpoint for the frontend to call when they serve consent via a particular component. Add new tables to store that consent was served. Update the requests that save preferences to optionally pass in the id where we served the preference to be able to calculate conversion in the future. When retrieving preferences for a given user embedded on notices, also return whether that notice was served.
Code Changes
Some new tables were added and several methods abstracted to share code between when saving preferences and recording that consent is served, as we track very similar details
servednoticehistory
to track every single time a version of a notice is served for consent reportinglastservednotice
table to consolidate the last time a notice was served, across any version, for all the known identifies of a userprivacypreferencehistory.served_notice_history_id
to link the record between a notice being served, and the preferences being saved with respect to that noticeConsentReportingMixin
to share common fields betweenPrivacyPreferenceHistory
andServedNoticeHistory
tablesupsert_last_saved_record
to share common code between upserting aCurrentPrivacyPreference
or aLastServedNotice
recordverify_privacy_notice_and_historical_records
to share with multiple API endpointssupplement_request_with_user_and_experience_details
to share when saving preferences and the fact that notices were served. Both locations record a lot of information about the user.Steps to Confirm
nox -s dev -- shell
PATCH http://localhost:8080/api/v1/notices-served
served_notice_history_id
(s) in the responsePATCH http://localhost:8080/api/v1/privacy-preferences
GET http://localhost:8080/api/v1/privacy-experience?show_disabled=true®ion=us_ca&fides_user_device_id=3e2e5f7c-5367-47d4-b672-9427626c71db
Truncated Response:
PATCH http://localhost:8080/api/v1/privacy-notice
GET http://localhost:8080/api/v1/privacy-experience?show_disabled=true®ion=us_ca&fides_user_device_id=3e2e5f7c-5367-47d4-b672-9427626c71db
Truncated Response:
POST http://localhost:8080/api/v1/consent-request
PATCH http://localhost:8080/api/v1/consent-request/<consent_request_id>/notices-served
Pre-Merge Checklist
CHANGELOG.md
For API changes, the Postman collection has been updatedPostman is not working on my machine at all at the moment, I've spent too much time trying to get this up and running